add_subdirectory(server_example_simple)
add_subdirectory(server_example_basic_io)
add_subdirectory(server_example_password_auth)
add_subdirectory(server_example_write_handler)
add_subdirectory(server_example_control)
add_subdirectory(server_example_dynamic)
add_subdirectory(server_example_config_file)
add_subdirectory(server_example_complex_array)
add_subdirectory(server_example_threadless)
add_subdirectory(server_example_61400_25)
add_subdirectory(server_example_setting_groups)
add_subdirectory(server_example_logging)
add_subdirectory(server_example_files)
add_subdirectory(server_example_substitution)
add_subdirectory(server_example_service_tracking)
add_subdirectory(server_example_deadband)
add_subdirectory(server_example_access_control)

add_subdirectory(iec61850_client_example1)
add_subdirectory(iec61850_client_example2)
add_subdirectory(iec61850_client_example_control)
add_subdirectory(iec61850_client_example4)
add_subdirectory(iec61850_client_example5)
add_subdirectory(iec61850_client_example_reporting)
add_subdirectory(iec61850_client_example_log)
add_subdirectory(iec61850_client_example_array)
add_subdirectory(iec61850_client_example_files)
add_subdirectory(iec61850_client_example_async)
add_subdirectory(iec61850_client_file_async)
add_subdirectory(iec61850_client_example_rcbAsync)
add_subdirectory(iec61850_client_example_ClientGooseControl)
add_subdirectory(iec61850_client_example_ClientGooseControlAsync)

if (${BUILD_SNTP_CLIENT_EXAMPLES})
add_subdirectory(sntp_example)
endif()

if(${BUILD_R_SMV_EXAMPLES})
add_subdirectory(rsv_publisher_example)
add_subdirectory(rsv_subscriber_example)
endif()

if(${BUILD_R_GOOSE_EXAMPLES})
add_subdirectory(r_goose_publisher_example)
add_subdirectory(r_goose_receiver_example)
endif()

if (NOT WIN32)
    add_subdirectory(mms_utility)
endif(NOT WIN32)

if(WIN32)
    if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/winpcap/Lib/wpcap.lib")
        set(BUILD_SV_GOOSE_EXAMPLES ON)
        message("Found winpcap -> compile examples for GOOSE and SV")
    endif()
else()
    set(BUILD_SV_GOOSE_EXAMPLES ON)
endif()

if(WITH_MBEDTLS OR WITH_MBEDTLS3)
add_subdirectory(tls_client_example)
add_subdirectory(tls_server_example)
endif(WITH_MBEDTLS OR WITH_MBEDTLS3)

if(${BUILD_SV_GOOSE_EXAMPLES})
    add_subdirectory(server_example_goose)
    add_subdirectory(goose_observer)
    add_subdirectory(goose_subscriber)
    add_subdirectory(goose_publisher)
    add_subdirectory(sv_subscriber)
    add_subdirectory(iec61850_9_2_LE_example)
    add_subdirectory(iec61850_sv_client_example)
    add_subdirectory(sv_publisher)
endif()
